package com.datacow.moudle.constant;

import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;

/**
* @Description: 设置请求Site
* @Author: 李德森
* @Date: 2021/1/15
*/
public abstract class BasePageProcessor implements PageProcessor {
    private Site site = Site.me()
          // 网站首页
          .setDomain(ProductHuntInfo.MatchingRule.HOME_PAGE)
          // 休眠时间
          .setSleepTime(1000)
          // 编码
          .setCharset("utf-8")
          // 重试休眠时间
          .setRetrySleepTime(1000)
          // 重试次数
          .setRetryTimes(3)
          // 连接超时时间
          .setTimeOut(60000)
          .setUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31");

    @Override
    public Site getSite() {
        return site;
    }
}
